<?php
namespace pinduoduo\Request;

use pinduoduo\AbstractInterface\Request;

class PddDdkGoodsZsUnitUrlGenRequest extends Request
{
    /**
     * 多多进宝转链接口
     * @var string
     */
    private $type = 'pdd.ddk.goods.zs.unit.url.gen';

    /**
     * 自定义参数，为链接打上自定义标签；自定义参数最长限制64个字节；格式为： {"uid":"11111","sid":"22222"} ，其中 uid 用户唯一标识，可自行加密后传入，每个用户仅且对应一个标识，必填； sid 上下文信息标识，例如sessionId等，非必填。该json字符串中也可以加入其他自定义的key。（如果使用GET请求，请使用URLEncode处理参数）
     * @var
     */
    private $customParameters;

    /**
     * 获取微信ShortLink链接，仅支持单个商品，单个渠道每天生成的shortLink数量有限，请合理生成shortLink链接
     * @var
     */
    private $generateShortLink;

    /**
     * 渠道id
     * @var
     */
    private $pId;

    /**
     * 需转链的链接，支持拼多多商品链接、进宝长链/短链（即为pdd.ddk.goods.promotion.url.generate接口生成的长短链）
     * @var
     */
    private $sourceUrl;

    /**
     * 是否生成微信LongLink
     * @var
     */
    private $generateWeAppLongLink;

    public function setType($type)
    {
        $this->type = $type;
    }

    public function getType()
    {
        return $this->type;
    }

    public function setCustomParameters($customParameters)
    {
        $this->customParameters = $customParameters;
    }

    public function getCustomParameters()
    {
        return $this->customParameters;
    }

    public function setGenerateShortLink($generateShortLink)
    {
        $this->generateShortLink = $generateShortLink;
    }

    public function getGenerateShortLink()
    {
        return $this->generateShortLink;
    }

    public function setPId($pId)
    {
        $this->pId = $pId;
    }

    public function getPId()
    {
        return $this->pId;
    }

    public function setSourceUrl($sourceUrl)
    {
        $this->sourceUrl = $sourceUrl;
    }

    public function getSourceUrl()
    {
        return $this->sourceUrl;
    }

    public function setGenerateWeAppLongLink($generateWeAppLongLink)
    {
        $this->generateWeAppLongLink = $generateWeAppLongLink;
    }

    public function getGenerateWeAppLongLink()
    {
        return $this->generateWeAppLongLink;
    }

    public function getParams()
    {
        $params = [
            'type'                      => $this->type,
            'custom_parameters'         => $this->customParameters,
            'generate_short_link'       => $this->generateShortLink,
            'pid'                       => $this->pId,
            'source_url'                => $this->sourceUrl,
            'generate_we_app_long_link' => $this->generateWeAppLongLink,
        ];
        return array_filter($params);
    }
}
